﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Model.Enum;

namespace UIDesign
{
    public class MainHelp
    {
        //控件字符串形式列表
        public static string[] LIST = new string[] { "Radio", "CheckBox", "PopWin", "Text", "TextArea", "Select", "Password", "File", "Button", "Hidden" };
        public static string[] SLIST = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
        private static List<string> CNLIST = new List<string>();

        public static ItemLabel CreateControl(ControlType ctype)
        {
            ItemLabel ctl = new ItemLabel();
            ctl.AllowDrop = true;
            ctl.BorderStyle = BorderStyle.FixedSingle;
            ctl.ControlStr = LIST[Convert.ToInt32(ctype)];
            ctl.Width = 180;
            
            return ctl;
        }

        public static bool AddCnList(string code)
        {
            if(CNLIST.IndexOf(code) > -1)
            {
                return false;
            }

            CNLIST.Add(code);
            return true;
        }

        public static bool InList(string code)
        {
            return CNLIST.IndexOf(code) > -1;
        }

        public static void Remove(string code)
        {
            if(string.IsNullOrEmpty(code))
                CNLIST.Clear();
            else
                CNLIST.Remove(code);
        }
    }
}
